name_filter :remote_fresh_only do |names, configurations, options|
  local_area = ::Wondercap::Deployment::Area.find_by_name("local")
  raise "no current snapshot" unless local_area && local_area.current_snapshot

  next names unless options[:area] && options[:area].current_snapshot

  names.delete_if do |name|
    next false if options[:force_deploy] && options[:supplied_names].include?(name)
    
    local_dep = local_area.current_snapshot.find_deployment_by_name(name)
    raise "no deployment for #{name} found" unless local_dep
    remote_dep = options[:area].current_snapshot.find_deployment_by_name(name)

    remote_dep != nil && remote_dep.revision == local_dep.revision# && remote_dep.deployed_at >= local_dep.deployed_at
  end
end
